/**
 * Copyright (C) 2017 - 2020 https://github.com/joewee
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.bifrost.service;

import com.bifrost.entity.IndexSetting;
import com.bifrost.entity.IndexSettingRegion;
import com.bifrost.entity.MerchantStore;
import org.springframework.data.domain.Page;

import java.io.IOException;
import java.util.Collection;
import java.util.List;

/**
 * @author joewee
 * @version 1.0.0
 * @Date 2017/10/20 10:54
 */
public interface IndexSettingRegionService {
    List<IndexSettingRegion> findAllVisible();
    List<IndexSettingRegion> findAllVisibleByStore(MerchantStore store);

    /**
     * 获取首页所有配置
     * @param merchantId
     * @param storeName
     * @param page
     * @param pageSize
     * @param visible
     * @return
     */
    Page<IndexSettingRegion> findAll(Long merchantId, String storeName, Integer page, Integer pageSize, Boolean visible);

    /**
     * 新增/更新首页
     * @param region
     * @return
     */
    IndexSettingRegion save(IndexSettingRegion region);

    /**
     * 根据ID查找配置
     * @param id
     * @return
     */
    IndexSettingRegion findById(Long id);

    /**
     * 检查门店配置信息是否存在
     * @param store
     * param ids
     * @return
     */
    List<IndexSettingRegion> findAllByStoreAndIndexRegionId(MerchantStore store,Collection ids);

    /**
     * 删除配置信息
     * @param ids
     * @param store
     */
    void deleteByIdAndStore(Collection ids,MerchantStore store);

    /**
     * 获取指定门店配置
     *
     * @param visible
     * @param indexRegionId
     * @param page
     * @param  pageSize
     * @return
     */
    Page<IndexSetting> findByIndexRegionId(String visible, Long indexRegionId, Integer page, Integer pageSize);

    /**
     * 根据指定门店增加/修改详细配置
     * @param  setting
     * @return
     */
    IndexSetting save(IndexSetting setting) throws IOException;

    /**
     * 检查指定门店配置信息是否存在
     * @param region
     * @return
     */
    List<IndexSetting> finfByIndexRegionId(IndexSettingRegion region);

    /**
     * 检查指定门店配置信息是否存在
     * @param indexSettingId
     * @return
     */
    IndexSetting findByIndexSettingId(Long indexSettingId);

    /**
     * 检查指定门店详细配置
     * @param indexSettingId
     * @param region
     * @return
     */
    IndexSetting findByIndexSettingIdAndIndexSettingRegion(Long indexSettingId,IndexSettingRegion region);

    /**
     * 删除指定门店配置信息
     * @param  indexSettingIds
     * @return
     */
    void deleteByIndexSettingId(Collection indexSettingIds);



}
